{extend name="base"}
{block name="title"}平台综合业绩{/block}
{block name="head"}
<script src="__STATIC__/common/avalon.mobile-2.2.9.min.js"></script>
<style>
.tab-content{padding:10px;}
ul.report {font-size:12px;}
ul.report li {display: inline-block; margin:4px;}
ul.report table {min-width:335px;}
ul.report table th {
  font-weight:400;
  color:#333;
  text-align:center;
  padding: 2px 10px;
}
ul.report table caption{
  border:1px solid #eee;
  border-bottom:0;
  background-color: #f9f9f9;
  padding: 2px 10px;
  line-height: 26px;
  height: 28px;
  color: #333;
}
ul.report table td{text-align:right;}
</style>
{/block}
{block name="body"}
<body class="mainbody ms-controller" ms-controller="Report">
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i class="iconfont icon-up"></i><span>返回上一页</span></a>
  <a href="{:url('index/home')}" class="home"><i class="iconfont icon-home"></i><span>首页</span></a>
  <i class="arrow iconfont icon-arrow-right"></i>
  <span>平台综合业绩</span>
</div>
<!--/导航栏-->

<!--内容-->

<div class="tab-content">

  <ul class="report">
    <li ms-for="(k,v) in @Pannel">
      <table border="0" cellspacing="0" cellpadding="0" class="border-table">
        <caption>[{{v.ID}}]{{v.Name}}</caption>
        <thead>
          <tr>
            <th>#{{k}}</th>
            <th>充值</th>
            <th>佣金</th>
            <th>利润</th>
          </tr>
        </thead>
        <tbody>
          <tr><th>累计</th><td>{{v.D.a|number(2,'.','')}}</td><td>{{v.D.b|number(2,'.','')}}</td><td>{{v.D.c|number(2,'.','')}}</td></tr>
          <tr><th>今天</th><td>{{v.D0.a|number(2,'.','')}}</td><td>{{v.D0.b|number(2,'.','')}}</td><td>{{v.D0.c|number(2,'.','')}}</td></tr>
          <tr><th>昨天</th><td>{{v.D1.a|number(2,'.','')}}</td><td>{{v.D1.b|number(2,'.','')}}</td><td>{{v.D1.c|number(2,'.','')}}</td></tr>
          <tr><th>本周</th><td>{{v.D7.a|number(2,'.','')}}</td><td>{{v.D7.b|number(2,'.','')}}</td><td>{{v.D7.c|number(2,'.','')}}</td></tr>
          <tr><th>上周</th><td>{{v.D14.a|number(2,'.','')}}</td><td>{{v.D14.b|number(2,'.','')}}</td><td>{{v.D14.c|number(2,'.','')}}</td></tr>
          <tr><th>本月</th><td>{{v.D30.a|number(2,'.','')}}</td><td>{{v.D30.b|number(2,'.','')}}</td><td>{{v.D30.c|number(2,'.','')}}</td></tr>
          <tr><th>上月</th><td>{{v.D60.a|number(2,'.','')}}</td><td>{{v.D60.b|number(2,'.','')}}</td><td>{{v.D60.c|number(2,'.','')}}</td></tr>
        </tbody>
      </table>
    </li>
  </ul>

</div>
<!--/内容-->
<script>
avalon.ready(function () {

  var Channel = {$CHANNELS|default=[]|json_encode=JSON_UNESCAPED_UNICODE};
  var dataALL = {$list|default=[]|json_encode=JSON_UNESCAPED_UNICODE};

  avalon.log(Channel, dataALL);
  
  var Pannel = [];
  (function fixDataALL() {
    avalon.each(Channel, function (CID, CHA) {
      var elm = {
        ID: CID,
        Name: CHA.Name,
        D: {a:0,b:0,c:0},
        D0: {a:0,b:0,c:0},
        D1: {a:0,b:0,c:0},
        D7: {a:0,b:0,c:0},
        D14: {a:0,b:0,c:0},
        D30: {a:0,b:0,c:0},
        D60: {a:0,b:0,c:0}
      };
      avalon.each(dataALL, function (c, d) {
        avalon.each(['D', 'D0', 'D1', 'D7', 'D14', 'D30', 'D60'], function (e, f) {
          if (d.t == f && d.Channel == CID) {
            elm[f].a = d.a * 1;
            elm[f].b = d.b * 1;
            elm[f].c = d.a - d.b;
            return false;
          }
        });
      });
      Pannel.push(elm);
    });
  })();

  var vm = avalon.define({
    $id: "Report",
    Pannel: Pannel
  });
  avalon.scan(document.body);

});
</script>
</body>
{/block}